<?php

/**
 * @var News[] $data
 * @var Pagination $pager
 */

use home\assets\PageAsset;
use home\models\News;
use yii\data\Pagination;

$links = $pager->getLinks();

PageAsset::register($this)->init([
]);
?>
<div class="carousel fade internal-slider" data-ride="carousel" data-interval="3000" id="slider">
    <div class="carousel-inner">
        <div class="item active">
            <div class="item-bg" style="background: url('/img/slide/NEWS1.jpg');"></div>
        </div>
    </div>
</div>

<div class="container">
    <div class="row">
        <?php foreach ($data as $datum) { ?>
            <div class="news">
                <div class="col-sm-3 nopadding hidden-xs">
                    <a href="https://www.ortea.it/en/tailor-made-2-sirius-in-1/">
                        <img width="945" height="472" src="<?= $datum->getImage(945, 472) ?>" class="img-responsive wp-post-image" loading="lazy" srcset="<?= $datum->getImage(945, 472) ?>, <?= $datum->getImage(300, 150) ?> 300w, <?= $datum->getImage(768, 384) ?> 768w" sizes="(max-width: 945px) 100vw, 945px"/>
                    </a>
                </div>
                <div class="col-xs-12 visible-xs">
                    <a href="https://www.ortea.it/en/tailor-made-2-sirius-in-1/">
                        <img width="945" height="472" src="<?= $datum->getImage(945, 472) ?>" class="img-responsive wp-post-image" loading="lazy" srcset="<?= $datum->getImage(945, 472) ?>, <?= $datum->getImage(300, 150) ?> 300w, <?= $datum->getImage(768, 384) ?> 768w" sizes="(max-width: 945px) 100vw, 945px"/>
                    </a>
                </div>
                <div class="col-sm-9 color-white">
                    <a href="<?= $datum->getViewUrl() ?>">
                        <h3 class="hidden-xs"><?= $datum->title ?></h3>
                        <h3 class="visible-xs nopadding col-xs-12"><?= $datum->title ?></h3>
                    </a>
                    <?= $datum->description ?>
                </div>
            </div>

            <div class="col-sm-12 nopadding">
                <hr/>
            </div>
        <?php } ?>

        <div class="pull-right posts-navigation">
            <?php if (isset($links[Pagination::LINK_NEXT])) { ?>
                <a href="<?= $links[Pagination::LINK_NEXT] ?>">下一页 »</a>
            <?php } ?>
        </div>
        <div class="pull-left posts-navigation">
            <?php if (isset($links[Pagination::LINK_PREV])) { ?>
                <a href="<?= $links[Pagination::LINK_PREV] ?>">上一页 »</a>
            <?php } ?>
        </div>

    </div>
</div>